package com.resign.carl.decorate.api.impl;

import com.resign.carl.decorate.api.Beverage;
import com.resign.carl.decorate.api.CondimentDecorator;

/**
 * Created by carl.zhao on 2016/6/14.
 */
public class Mocha extends CondimentDecorator {

    private Beverage beverage;

    public Mocha(Beverage beverage){
        this.beverage = beverage;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription() + ", Mocha";
    }

    @Override
    public double cost() {
        // 要计算Macha饮料的价钱,首先把调用委托给被装饰对象,
        // 以计算价钱,然后再加上Mocha的价钱,得到最后结果
        return .20 + beverage.cost();
    }
}
